import Tkinter as tk
class MainClass:

    
    def __init__(self):
        self.window_width = 200   # Window properties
        self.window_height = 200
        self.bodies = []
        self.Duckx = 38
        self.Ducky = 486
        self.Duckvx = 1000
        self.Duckvy = 200
        self.Redx = 998
        self.Redy = 86
        self.Redvx = -1000
        self.Redvy = 100
   
    def Draw(self):
        #print self.Duckx
        self.canvas.delete("all")
        self.canvas.create_image(0, 0, image = self.gif1, anchor = tk.NW)
        self.canvas.create_image(self.Duckx, self.Ducky, image = self.birdImage)
        self.canvas.create_image(self.Redx, self.Redy, image = self.birdImage2)
    def animateDuck(self):
        #print self.Ducky
        self.Duckx = self.Duckx + self.Duckvx*0.05
        self.Ducky = self.Ducky + self.Duckvy*0.05
        self.Draw()
        self.canvas.after(100,self.animateDuck)
        if self.Duckx >= 988:
            self.Duckx = -200
        if self.Ducky >= 564:
            self.Duckvy = -100
        if self.Ducky <= -1:
            self.Duckvy = 100
    def animateRed(self):
        #print self.Ducky
        self.Redx = self.Redx + self.Redvx*0.05
        self.Redy = self.Redy + self.Redvy*0.05
        self.Draw()
        self.canvas.after(100,self.animateRed)
        if self.Redx <= 0:
            self.Redx = 988
        if self.Redy >= 564:
            self.Redvy = -100
        if self.Redy <= -1:
            self.Redvy = 100
        
    def mouseClick(self,event):
        shotx = event.x
        shoty = event.y
        if shotx >= self.Duckx - 30 and shotx <= self.Duckx + 30 and shoty >= self.Ducky - 30 and shoty <= self.Ducky + 30:
            self.birdImage = self.deadbird
            self.Duckvx = 0
            self.Duckvy = 1000
            
        if shotx >= self.Redx - 30 and shotx <= self.Redx + 30 and shoty >= self.Redy - 30 and shoty <= self.Redy + 30:
            self.birdImage2 = self.deadbird2
            self.Redvx = 0
            self.Redvy = 1000
            
        if self.Duckvx == 0 and self.Ducky >= 416:
            self.birdImage = self.livebird  
            self.Duckx = 38
            self.Ducky = 486
            self.Duckvx = 1000
            self.Duckvy = 200
            
        if self.Redvx == 0 and self.Redy >= 416:
            self.birdImage2 = self.Redbird
            self.Redx = 998
            self.Redy = 86
            self.Redvx = -1000
            self.Redvy = 75
    def CheckWin(self):
        if self.birdImage == self.deadbird and self.birdImage2 == self.deadbird2:
            print "YOW WIN!!!!"
    def run(self):
        self.master = tk.Tk()
        self.canvas = tk.Canvas(width = 987, height = 721, bg = 'black')
        self.gif1 = tk.PhotoImage(file = 'DuckHunter.gif')
        self.livebird = tk.PhotoImage(file = 'greenbird.gif')
        self.deadbird = tk.PhotoImage(file = 'Dead Duck.gif')
        self.Redbird = tk.PhotoImage(file = 'redbird.gif')
        self.deadbird2 = tk.PhotoImage(file = 'Dead redbird.gif')
        self.birdImage = self.livebird  
        self.birdImage2 = self.Redbird
        self.canvas.create_image(0, 0, image = self.gif1, anchor = tk.NW)
        self.canvas.bind('<Button-1>', self.mouseClick)
        self.canvas.pack()
        self.Draw()
        self.animateDuck()
        self.animateRed()
        self.CheckWin()
        tk.mainloop()
        
program = MainClass()
program.run()